package com.wo.cloud.admin.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wo.cloud.admin.entity.SysRole;
import com.wo.cloud.admin.mapper.SysRoleMapper;
import com.wo.cloud.admin.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/5/15 22:45
 * Description:
 */

@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements IRoleService {


    @Autowired
    private SysRoleMapper roleMapper;

    /**
     * 分页条件查询
     * @param page
     * @param name
     * @return
     */
    @Override
    public IPage<SysRole> selectPage(Page page, String name) {
        LambdaQueryWrapper<SysRole> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        return roleMapper.selectPage(page, lambdaQueryWrapper.like(StrUtil.isNotBlank(name), SysRole::getName, name));
    }
}
